import fractions

def lcm(a,b) : return abs( a * b ) / fractions.gcd(a,b) if a and b else 0

def prime_factors(n):
    """Returns all the prime factors of a positive integer"""
    factors = []
    d = 2
    while n > 1:
        while n % d == 0:
            factors.append(d)
            n /= d
        d = d + 1

    return factors

if __name__ == '__main__':
	print "gcd(2^4 * 3^2 * 5 * 7^2, 2 * 3^3 * 7 * 11) = ", prime_factors(fractions.gcd(pow(2,4)*pow(3,2)*5*pow(7,2),2*pow(3,3)*7*11))
	print "lcm(2^3 * 3^2 * 5, 2 * 3^3 * 7 * 11) = ", prime_factors(lcm(pow(2,3) * pow(3,2) * 5 , 2 * pow(3,3) * 7 * 11))